#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
void swap(char* p1, char* p2, size_t lenth)
{
	for (int k = 0; k < lenth; k++)
	{
		char temp = *((char*)p1 + k);
		*((char*)p1 + k)= *((char*)p2+k);
		*((char*)p2 + k) = temp;

	}
}
void my_qsort(void*p, size_t sz,size_t lenth,int(*funk)(const void * p1,const void * p2))
{
	for (int j = 0; j < sz - 1; j++)
	{
		for (int i = 0; i < sz - 1 - j; i++)
		{
			if (funk((char*)p+i*lenth,(char*)p+(i+1)*lenth) > 0)
			{
					
				swap((char*)p + i * lenth, (char*)p + (i + 1) * lenth, lenth);
					
			
			}
		}
	
	}
}
int text(const void* p1, const void* p2)
{
	return *(int*)p1 - *(int*)p2;
}
int main()
{
	int arr[] = { 0 , 3 ,2, 1, 6, 8 ,1 };
	my_qsort(arr, sizeof(arr) / sizeof(arr[0]), sizeof(arr[0]), text);
	return 0;
}